package com.lyh.common.enums;

import lombok.Data;

/**
 * 用户状态
 *
 * @author lyh
 */
public enum YesOrNoEnum
{
    YES(1, "是"),
    NO(0, "否");

    private  Integer code;
    private  String info;

    YesOrNoEnum(Integer code, String info) {
        this.code = code;
        this.info = info;
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getInfo() {
        return info;
    }

    public void setInfo(String info) {
        this.info = info;
    }

    public static YesOrNoEnum getEnum(Integer code) {
        for (YesOrNoEnum el : YesOrNoEnum.values()) {
            if (el.getCode() == code) {
                return el;
            }
        }

        return null;
    }
}
